<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>用户名</title>
    <link rel="stylesheet" href="../../static/layui/css/layui.css" th:href="@{https://cdn.staticfile.org/layui/2.7.6/css/layui.css}">
    <script src="../../static/layui/jquery-3.4.1.min.js" th:src="@{https://cdn.bootcss.com/jquery/3.4.1/jquery.js}"></script>
    <script src="../../static/layui/layui.js" th:src="@{https://cdn.staticfile.org/layui/2.7.6/layui.js}"></script>
    <script src="../../static/layer/layer.js" th:src="@{https://cdn.staticfile.org/layer/3.5.1/layer.js}"></script>

</head>
<body>
<div class="layui-inline">
    <input type="text" value="" placeholder="请输入用户名称/昵称/手机号" class="layui-input search_input" id="sm_no">
    <div class="layui-inline">
        <button class="layui-btn layui-btn-sm" id="serch_btn" onclick="serch_btn()">查询</button>
        <a class="layui-btn layui-btn-sm" lay-event="add" th:href="@{/user/to/toAddUser}">新增</a>
        <button class="layui-btn layui-btn-sm" lay-event="del">批量删除</button>
    </div>

<table id="userDemo" class="layui-table" lay-filter="supplier"></table>



</div>


</body>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/javascript" >/*th:inline="none"*/

var table = layui.table;
//执行渲染
table.render({
    elem:"#userDemo" //指定元素表格元素选择器（推荐id选择器）
    ,url:'/mall-user-service/user/queryUserLayUiPage'
    ,page:true
    ,title:'区域'
    ,limit:10
    ,skin:'line'//行边框风格
    ,even:true //开启隔行背景
    ,size: 'sm' //小尺寸的表格
    ,limits:[10,20,30,50,90]
    ,cols:[
        [
            {checkbox:true},
            {field:'userid',title:'用户id', sort: true},
            {field:'username',title:'用户名称', sort: true},
            {field:'state',title:'用户状态', sort: true,templet:function(d){
                if(d.state == 0){
                    return '待审核';
                }else if(d.state == 1){
                    return '启用' ;
                }else if(d.state == 2){
                    return '禁用' ;
                }else{
                    return '冻结';
                }
                }},
            {field:'type',title:'用户类型', sort: true,templet:function (d){
                if(d.type == 1){
                    return '采购人'
                }else if(d.type == 2){
                    return '供应者'
                }else{
                    return '管理员'
                }
                }},
            {field:'auditstate',title:'审核状态', sort: true,templet:function (d){
                if(d.auditstate == 0){
                    return '待审核';
                }else if(d.auditstate == 1){
                    return '审核通过';
                }else if(d.auditstate == 2){
                    return '审核不通过';
                }else if(d.auditstate == 3){
                    return '驳回';
                }
                }},
            {field:'nickname',title:'昵称'},
            {field:'createtime',title:'创建时间', sort: true, templet: function (d) {
                    if (d.createtime && d.createtime !== '' && d.createtime !== null ) {
                        return layui.util.toDateString(d.createtime, 'yyyy-MM-dd HH:mm:ss')
                    } else {
                        return '';
                    }
                }
            },
            {field:'audittime',title:'审核时间', sort: true, templet: function (d) {
                    if (d.audittime && d.audittime !== '' && d.audittime !== null ) {
                        return layui.util.toDateString(d.audittime, 'yyyy-MM-dd HH:mm:ss')
                    } else {
                        return '';
                    }
                }},
            {field:'phone',title:'电话号码'},
            {fixed: 'right', title:'操作' , width: 200, align:'center', toolbar: '#barDemo'},
        ]
    ]  //设置表头
});

</script>
</html>